import os
from fastapi import APIRouter
from fastapi import APIRouter,HTTPException
app = APIRouter()


app = APIRouter()


@app.get('/api')
async def api() -> dict:
    """
    测试接口
    :return:
    """

@app.get('/api_test')
async def api_test(name: str) -> dict:
    """测试异常接口"""
    try:
        print(username)
    except Exception as e:
        raise HTTPException(status_code=500, detail=str(e))

    return {'title': 'FastApp'}